//
// Created by yunnan xu on 2021/1/1.
//

#ifndef ANDROIDGRAPHICSDEMOS_COMPUTEPASS_H
#define ANDROIDGRAPHICSDEMOS_COMPUTEPASS_H

#include "Pass.h"
#include <unordered_map>
#include <string>
#include <EGL/egl.h>
#include <GLES3/gl32.h>
#include "ComputeParticles.h"
#include "glm.hpp"


template<GraphicsAPI API> class ComputePass;
template <GraphicsAPI> class RWBuffer;



template<> class ComputePass<GraphicsAPI::GLESv3> : public GLESPass
{
public:
    ComputePass();
    ComputePass(void * rwBufferData, uint32_t particleSize, uint32_t particleNum);

    virtual ~ComputePass() = default;
    virtual void Draw();

    std::shared_ptr<RWBuffer<GraphicsAPI::GLESv3>> GetBuffer();

protected:
    virtual void InitShaderUniformLocation();
    std::shared_ptr<RWBuffer<GraphicsAPI::GLESv3>> rwBuffer;
    std::shared_ptr<RWBuffer<GraphicsAPI::GLESv3>> spaceBuffer;
    int timestep_location;
};



#endif //ANDROIDGRAPHICSDEMOS_COMPUTEPASS_H
